<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <link rel="stylesheet" href="css/login.css">
    <link rel="stylesheet" href="font_571425_cjvso7da05wv1jor/iconfont.css" type="text/css" rel="stylesheet" />
    <script src="jq/jquery-1.11.1.min.js"></script>
    <link rel="stylesheet" href="css/public_login_register.css">
    <link rel="stylesheet" href="css/footer.css">
</head>
<body>
    <div class="public_login_register"></div>
    <script src="js/public_login_register.js"></script>
</div>
<div class="content">
    <div class="main">
        <div class="login_box">
            <div class="userlogin_title">
                <span class="fl">登录</span>
                <a href="" class="fr">注册</a>
            </div>
            <div class="user_info">
                <form method="post">
                    <div class="u_info_h mobile">
                    <p class="u_info_txt">
                        <input id="signup-mobile" class="sign_txt" type="text" name="userName" placeholder="请输入您的手机号" isvalid="false">
                    </p>
                    <p class="error"></p>
                    </div>

                    <div class="u_info_password u_info_h password">
                        <p class="u_info_txt"><input id="signup-password" class="sign_txt" type="password" name="userPwd" placeholder="请输入密码" isvalid="false"></p>
                        <!-- <p class="error">密码长度需6-16位字符</p> -->
                        <p class="error"></p>
                    </div>

                    <div class="u_info_btn">
                        <p><input type="submit" id="signup-submit" value="登录"/></p>
                        <p class="error" id="loginerror"></p>
                    </div>
                </form>

            </div>
        </div>
    </div>
</div>

<div class="public_footer"></div>
    <script src="js/footer.js"></script>
</body>
</html>

<script>
    $(function () {
        $("form").on("submit",function () {
            $.ajax({
                url:"../severs/login.php",
                data:$(this).serialize(),
                type:"post",
                dataType:"json"
            }).then(function (res) {
                console.log(res);
                var result=res;
                if(result.status==1){
                    loginerror.innerHTML=result.msg;
                    alert(result.msg);
                    window.sessionStorage.setItem("userinfo",result.tel);
                    window.location.assign("index.html");
                }else {
                    loginerror.innerHTML=result.msg.fontcolor("red");
                }
            })
            return false;
        })
    })
</script>